#pragma once
#include "..\lib\container\List.h"
#include <string>

namespace ds {

class Action {

public:
	Action(const std::string& name) : m_Name(name) {}
	virtual ~Action(void) {}
	virtual void start() = 0;
	virtual void stop() = 0;
	virtual void update(float elapsed) = 0;
	void setActive(bool active) {
		m_Active = active;
	}
	bool isActive() const {
		return m_Active;
	}
	void setNextAction(Action* action) {
		m_NextAction = action;
	}
	Action* getNextAction() {
		return m_NextAction;
	}
	std::string& getName() {
		return m_Name;
	}
private:
	std::string m_Name;
	Action* m_NextAction;
	bool m_Active;
};

class ActionGroup : public Action {

typedef List<Action*> Actions;

public:
	ActionGroup(const std::string& name) : Action(name) {}
	virtual ~ActionGroup();
	void start();
	void stop();
	void update(float elapsed);	
	void addAction(Action* action) {
		m_Actions.append(action);
	}
private:
	Actions m_Actions;	
};

}

